<?php 
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\widgets\LinkPager;
 ?>

<!DOCTYPE html>
<html>

<head>  

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - Bootstrap3 表单构建器</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

    <style>
        .droppable-active {
            background-color: #ffe !important;
        }

        .tools a {
            cursor: pointer;
            font-size: 80%;
        }

        .form-body .col-md-6,
        .form-body .col-md-12 {
            min-height: 400px;
        }

        .draggable {
            cursor: move;
        }
    </style>

</head>

<body class="gray-bg">

                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <!-- <center><input type="text" name="search" ><button id="but">搜索</button></center> -->
                                    <tr>

                                        <th></th>
                                        <th>ID</th>
										<th>公司名字</th>
										<th>公司地址</th>
										<th>状态</th>
									
                                    </tr>
                                </thead>
                                <tbody>
                                <?php foreach($compony as $key=>$val){ ?>
								<tr>
								<td>
                                            <input type="checkbox" class="i-checks" name="input[]">
                                        </td>
									<td><?php echo $val['compony_msg_id'] ?></td>
									<td><?php echo $val['compony_name'] ?></td>
									<td><?php echo $val['compony_area'] ?></td>
									<td>
										<select name="status" id="<?php echo $val['compony_msg_id'] ?>" >
											
											<option  value="0" <?php if ($val['status']==0) {
												echo "selected";
											} ?>>拒绝</option>
											
											<option  value="1" <?php if ($val['status']==1) {
												echo "selected";
											} ?>>已审核</option>
										
											<option value="2" <?php if ($val['status']==2) {
												echo "selected";
											} ?>>未审核</option>
											
										</select>
									</td>
									
								</tr>
								<?php } ?>
                                   
                                </tbody>
                            </table>
                           <center> <?= LinkPager::widget(['pagination' => $pagination]) ?></center>
                        </div>

                    
</body>

</html>

<script src="/jquery.js"></script>
<script>
	$(function(){
		$("select[name='status']").change(function(){
			var status=$(this).val();
			var id=$(this).attr("id");
			// alert(id);
			$.ajax({
				url:"http://www.project.com/backend/web/index.php?r=position/statusa",
				type:'post',
				dataType:'json',
				data:{
					status:status,
					id:id
				},
				success:function(data){
					if (data.val==1) {
						alert(data.msg);
					}else{
						alert(data.msg);
					}
				}
			});
		});

		// $("#but").click(function(){
		// 	var search=$("input[name='search']").val();
		// 	$.ajax({
		// 		url:'?r=position/',
		// 		type:'post',
		// 		dataType:'json',
		// 		data:{search:search},
		// 		success:function(data)
		// 		{
		// 			if(data!=0)
		// 			{
		// 				src+='';
		// 				$(data).each(function(k,v){
		// 					src+='<tr><td><input type="checkbox" class="i-checks" name="input[]"></td>';
		// 					src+='<td>'+v.compony_msg_id+'</td>';
		// 					src+='<td>'+v.compony_name+'</td>';
		// 					src+='<td>'+v.compony_area+'</td>';
		// 					src+='<td><select name="status" id='+v.compony_msg_id+'>';
		// 					src+='<option  value="0"'+if (v.status==0) {echo "selected";}+'>拒绝</option>';
		// 					src+='<option  value="1" '+if (v.status==1) {echo "selected";}+'>已审核</option>';
		// 					src+='<option value="2" '+if (v.status==2) {echo "selected";}+'>未审核</option></select></td>';				
		// 				});
						
		// 			}
		// 		}
		// 	});
		// 	// alert(search);
		// });

	});

</script>

									
									
								